package pers.cz.node;

import pers.cz.mxgraph.MxCell;
import pers.cz.thread.ThreadUtils;

/**
 * @program: PostGirl-panent
 * @description: 延时节点
 * @author: Cheng Zhi
 * @create: 2023-02-03 14:13
 **/
public class DelayedNode extends AbstractNode {

    public DelayedNode(MxCell mxCell) {
        super(mxCell);
    }

    @Override
    public void runNode(NodeCallBack callBack) throws Exception {
        String time = mxCell.getMxObjectData().get("operation"); // 休眠时间
        try {
            if (Long.valueOf(time) > 0) {
                ThreadUtils.doSleep(Long.valueOf(time));
            }
        } catch (Exception e) {
            // 不做任何休眠操作
        }
    }

    @Override
    public void verify() {

    }

    @Override
    public String getName() {
        return mxCell.getName();
    }
}
